<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/logic/CustomCommand.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
		require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/entity/Department.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	

	
	/*
	* Class to validate a credential
	*/
	class CommandCreateDepartment extends CustomCommand {
		/*
		* Constructor of the class
		*/
		public function __construct ($name,$fkRifBranch) {
		$this -> department = new Department($name, $fkRifBranch);
			
					$GLOBALS['debug'] -> log($this -> department, "command");
		
		}
		
		/*
		* Method to execute to validate the credential
		*/
		public function execute() {

			$daoFactory= DaoFactory:: getMySqlDaoFactory();
			$iuad= $daoFactory-> getMySqlDepartmentAccessDao();	
			$GLOBALS['debug'] -> log($department, " datos del departamento en el comando");		
			$auth=$iuad->createDepartment($this -> department);
			

	
			$this -> result = $auth;
		}
	}
?>